﻿@model IEnumerable<ABCTile.Models.Project>

@{
    ViewBag.Title = "Index";
    AjaxOptions ajaxOpts = new AjaxOptions
    {
        UpdateTargetId = "SearchResults",
        Url = Url.Action("SearchProject")
    };
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>

@using (Ajax.BeginForm(ajaxOpts))
{
    <p>
        Find Project : @Html.TextBox("SearchString") &nbsp;
        <input type="submit" value="Search" />
    </p>
}

<div id = "SearchResults">
<table>
    <tr>
       <th>
            Project Name
        </th>
        <th>
            Street
        </th>
        <th>
            City
        </th>
        <th>
            State
        </th>
        <th>
            Zip Code
        </th>
        <th>
            Bid date
        </th>
        <th>
            Building type
        </th>
        <th>
            Work type
        </th>
        <th>
            Architect ID
        </th>
        <th>
            Owner ID
        </th>
        <th>
            Bid submit type
        </th>
        <th>
            Status
        </th>
        <th>
            Comment
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.projectName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.streetAddress)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.city)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.state)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.zip)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.bid_date)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.building_type)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.work_type)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.architectureID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ownerID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.bid_submit_type)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Status.StatusName)
        </td> 
       
        <td>
            @Html.DisplayFor(modelItem => item.comment)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.ProjectID }) |
            @Html.ActionLink("Details", "Details", new { id = item.ProjectID }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.ProjectID })
        </td>
    </tr>
}

</table>
</div>